import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteEslint from 'vite-plugin-eslint';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  base: '/',
  plugins: [
    react(),
    viteEslint({
      failOnError: false,
    }),
  ],
  resolve: {
    alias: [
      { find: '@src', replacement: path.join(__dirname, '/src') },
      { find: '@assets', replacement: path.join(__dirname, '/src/assets') },
      {
        find: '@const',
        replacement: path.join(__dirname, '/src/const'),
      },
      {
        find: '@components',
        replacement: path.join(__dirname, '/src/components'),
      },
      { find: '@hooks', replacement: path.join(__dirname, '/src/hooks') },
      { find: '@utils', replacement: path.join(__dirname, '/src/utils') },
      { find: '@apis', replacement: path.join(__dirname, '/src/apis') },
      { find: '@public', replacement: path.join(__dirname, '/public') },
    ],
  },
  build: {
    target: 'es2015',
    manifest: true,
    sourcemap: 'hidden',
  },
});
